import React from 'react';
import { NavMenu, Button } from '../components';
const data = [
    { label: "home", link: "/" },
    { label: "admin", link: "/admin" },
    { label: "programming", link: "/" },
    { label: "other", link: "/" }
];
class BodyView extends React.Component {

    componentDidMount() {
        this.initData();
    }
    render() {
        const { setState, actions, bodyData, match } = this.props;
        const { articles } = bodyData;
        const content = articles.find((a) => match.params.id === a._id) ? articles.find((a) => match.params.id === a._id).content : null;

        return (
            <div className="body">
                <div className="body-content">
                    
                    <div className="left-sec col-3">
                        <div className="col-12"><NavMenu data={articles} /></div>
                    </div>
                    <div className="main-sec col-9">
                        <div>
                            {content}
                        </div>
                    </div>
                </div>
            </div>
        );
    }
    initData = () => {
        const { actions } = this.props;
        actions.getArticle();
    }
}
export default BodyView;